//
//  TodayNewsTableViewCell.m
//  口袋
//
//  Created by dllo on 15/5/22.
//  Copyright (c) 2015年 口袋. All rights reserved.
//

#import "TodayNewsTableViewCell.h"
#import "DKNightVersion.h"

#define WIDTH [UIScreen mainScreen].bounds.size.width
#define HEIGHT [UIScreen mainScreen].bounds.size.height / 6.67
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

@implementation TodayNewsTableViewCell
- (void)dealloc
{
    [_image release];
    [_titleLabel release];
    [_contentLabel release];
    [_commentButton release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
        [self createLabel];
        [DKNightVersionManager addClassToSet:self.class];
        self.nightBackgroundColor = UIColorFromRGB(0x343434);
    }
    return self;
}

- (void)createView
{
    self.image = [[UIImageView alloc]initWithFrame:CGRectMake(HEIGHT * 0.1, HEIGHT * 0.1, HEIGHT, HEIGHT * 0.8)];
    [self.image setBackgroundColor:[UIColor grayColor]];
    [self addSubview:self.image];
    [self.image release];
    
}

- (void)createLabel
{
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(HEIGHT + HEIGHT * 0.2, HEIGHT * 0.05, WIDTH / 1.5 , HEIGHT / 2)];
   // [self.titleLabel setBackgroundColor:[UIColor orangeColor]];
    self.titleLabel.numberOfLines = 0;
    self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
    self.titleLabel.nightBackgroundColor = UIColorFromRGB(0x343434);
    self.titleLabel.nightTextColor = [UIColor lightGrayColor];
    [self addSubview:self.titleLabel];
    [self.titleLabel release];
    
    self.contentLabel = [[UILabel alloc]initWithFrame:CGRectMake(HEIGHT + HEIGHT * 0.2, HEIGHT / 7 * 3.2, WIDTH / 8 * 5, HEIGHT / 2)];
   // [self.contentLabel setBackgroundColor:[UIColor orangeColor]];
    self.contentLabel.numberOfLines = 0;
    self.contentLabel.textColor = [UIColor grayColor];
    self.contentLabel.font = [UIFont systemFontOfSize:14];
    [self addSubview:self.contentLabel];
    [self.contentLabel release];
    
    self.commentButton = [[UIButton alloc]initWithFrame:CGRectMake(0.77*WIDTH , 0.855 * HEIGHT, 0.22 *WIDTH, 0.12 * HEIGHT)];
    [self.commentButton setTitle:@"  跟帖数" forState:UIControlStateNormal];
    self.commentButton.titleLabel.font = [UIFont systemFontOfSize:11];
    [self.commentButton setImage:[UIImage imageNamed:@"comment.png"] forState:UIControlStateNormal];
    [self.commentButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [self.commentButton setBackgroundColor:[UIColor whiteColor]];
    self.commentButton.nightBackgroundColor = UIColorFromRGB(0x343434);
    [self addSubview:self.commentButton];
    [self.commentButton release];
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
